package com.lemon.soft.bookingroom.controller;

import java.util.Arrays;
import java.util.Map;


import com.lemon.soft.bookingroom.service.RoomTimeStatusService;
import com.lemon.soft.bookingroom.util.PageUtils;
import com.lemon.soft.bookingroom.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.lemon.soft.bookingroom.entity.MeetingRoomsEntity;
import com.lemon.soft.bookingroom.service.MeetingRoomsService;



/**
 * 
 *
 * @author ${author}
 * @email ${email}
 * @date 2025-05-29 12:38:52
 */
@CrossOrigin
@Tag(name = "会议室管理",description = "会议室的CRUD")
@RestController
@RequestMapping("bookingroom/meetingrooms")
public class MeetingRoomsController {
    @Autowired
    private MeetingRoomsService meetingRoomsService;


    @Autowired
    private RoomTimeStatusService roomTimeStatusService;



    /**
     * 列表
     */
    @Operation(summary = "展示所有会议室")
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = meetingRoomsService.queryPage(params);

        return R.ok().put("page", page);
    }

    /**
     * 保存
     */
    @Operation(summary = "新增会议室")
    @PostMapping("/save")
    public R save(@RequestBody MeetingRoomsEntity meetingRooms){
		meetingRoomsService.save(meetingRooms);

        return R.ok();
    }

    /**
     * 修改
     */
    @Operation(summary = "修改会议室信息")
    @PostMapping("/update")
    public R update(@RequestBody MeetingRoomsEntity meetingRooms){
		meetingRoomsService.updateById(meetingRooms);

        return R.ok();
    }

    /**
     * 删除
     */
    @Operation(summary = "删除会议室")
    @PostMapping("/delete/{roomId}")
    public R delete(@PathVariable Integer roomId){
		meetingRoomsService.removeById(roomId);

        return R.ok();
    }

}
